package excption.work;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class test6 {
    public static void main(String[] args)throws Exception {
        FileOutputStream fos=new FileOutputStream("fos.txt");

        OutputStreamWriter osw =new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw=new BufferedWriter(osw);
        PrintWriter pw =new PrintWriter(osw);
        Scanner s=new Scanner(System.in);
        System.out.println("单独输出exit退出");
        while(true){
            String str=s.nextLine();
            if ("exit".equals(str)){
                break;
            }
            pw.println(str);
        }


        pw.close();



    }
}
